package adapter.testpaper;

import android.graphics.Color;
import android.support.annotation.Nullable;
import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import java.util.List;
import application.App;
import student.andlei.com.student.R;

public class PopupKnowledgePointAdapter extends BaseQuickAdapter<String,BaseViewHolder> {
    private final int color;
    private int tag=-1;

    public int getTag() {
        return tag;
    }

    public void setTag(int tag) {
        this.tag = tag;
    }

    public PopupKnowledgePointAdapter(int layoutResId, @Nullable List<String> data) {
        super(layoutResId, data);
        color = App.getInstance().getResources().getColor(R.color.color_light_gray);
    }

    @Override
    protected void convert(BaseViewHolder helper, String item) {
        helper.setText(R.id.tv_first_layer_chapter_dialog, item);
        View view = helper.getView(R.id.ll_first_layer_chapter_dialog);

        int layoutPosition = helper.getLayoutPosition();
        if (tag == layoutPosition) {
            view.setBackgroundColor(color);
        } else {
            view.setBackgroundColor(Color.WHITE);
        }
    }
}
